Skip to content

Update Assets fields on project build#1524

Merged
RobDangerous merged 1 commit intoKode:mainfrom
RblSb:assets-completion-invalidation
Mar 26, 2026
Merged

Update Assets fields on project build#1524
RobDangerous merged 1 commit intoKode:mainfrom
RblSb:assets-completion-invalidation

Conversation

@RblSb
Copy link
Copy Markdown
Contributor

@RblSb RblSb commented Mar 20, 2026

Keep Assets.type fields cache with mtime (modification time) and invalidate them when files.json modification time is updated. Also keep files.json cache/mtime.

Before this change: after you add new image, you need to build project and then restart haxe language server to fix missing field errors.
With this change: after you add new image, you only need to build project to update fields in Assets.

Tested with haxe4/haxe5.

I also added same cache impl to ShadersBuilder, because in Haxe 5, after registerModuleDependency and files.json update, macro will reparse files.json on every file focus (HaxeFoundation/haxe#12846).

I used this cache impl as reference: https://github.com/HeapsIO/heaps/blob/72143b6c4c72a8895d713b5d850258cac53ff4bf/hxd/res/DynamicText.hx#L366

There is also basic debug mode with reparse/invalidation traces when they happen, i can remove it.

@RobDangerous
Copy link
Copy Markdown
Member

Groovy!

@RobDangerous RobDangerous merged commit ea49f33 into Kode:main Mar 26, 2026
23 checks passed
@RblSb RblSb deleted the assets-completion-invalidation branch March 27, 2026 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants